package cn.tedu.reviem;

/**
 * @author: Dsi
 * @date: 2021/11/8 21:18
 * @description:
 */
public class TestOop02 {
    public static void main(String[] args) {
//        Father f=new Father();
//        Father f1=new Father(10);
        Son s = new Son();
    }
}
class G{
    int c=12;
}
class Father extends G{

   // int c=11;
    //构造代码块
    {
        System.out.println("我是父类的构造代码块,首先执行");
        System.out.println(c);
    }
    //定义变量
    String name;
    int age;
    int a = 10;
    int b = 100;
    //无参构造
    public Father() {
        System.out.println("我是无参构造");
        int a = 11;
        System.out.println(a);//11,就近原则
        System.out.println(this.a);//10
    }
    public Father(int a) {
        System.out.println("我是父类含参构造" + a);
    }
    public Father(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("我是全参构造");
        System.out.println(age);
    }
}
class Son extends Father {
    int a = 12;
    {
        System.out.println(super.c);//10
    }
    public Son() {
        super();
    }
    public Son(int a ){
        super(10);
        System.out.println("我是子类的含参构造"+a);

    }
}
